﻿<UserControl x:Class="Prism.Views.TextFileReaderAppMainView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:Gestures="clr-namespace:WpfUIUtilities.Gestures;assembly=WpfUIUtilities"
             xmlns:RegionNames="clr-namespace:Prism.Common.RegionNames;assembly=Prism.Common"
             xmlns:Regions="http://www.codeplex.com/CompositeWPF"
             mc:Ignorable="d" >

    <UserControl.InputBindings>
        <MouseBinding Gesture="{x:Static Gestures:MouseWheelDownKeyCtrlGesture.Instance}" Command="{Binding ZoomViewModel.ZoomDownCommand}"  />
        <MouseBinding Gesture="{x:Static Gestures:MouseWheelUpKeyCtrlGesture.Instance}" Command="{Binding ZoomViewModel.ZoomUpCommand}"  />
    </UserControl.InputBindings>

    <UserControl.LayoutTransform>
        <ScaleTransform 
            CenterX="0" CenterY="0"
            ScaleX="{Binding ZoomViewModel.ZoomFactor, Mode=TwoWay}"
            ScaleY="{Binding ZoomViewModel.ZoomFactor, Mode=TwoWay}"
        />
    </UserControl.LayoutTransform>

    <Grid x:Name="LayoutRoot" Background="Azure">

        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition />
            <RowDefinition />
        </Grid.RowDefinitions>

        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="0" />
            <ColumnDefinition Width="2*" />
        </Grid.ColumnDefinitions>

        <GridSplitter 
            Grid.Row="1" Grid.Column="0" Grid.RowSpan="2" Width="2"
            HorizontalAlignment="Right" VerticalAlignment="Stretch" 
            Background="Black" />

        <GridSplitter 
            Grid.Row="1" Grid.Column="1" Height="2"
            HorizontalAlignment="Stretch" VerticalAlignment="Bottom" 
            Background="Black" />

        <StackPanel
            Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2" Orientation="Horizontal" >
            <Menu>
                <MenuItem Header="Shut down" Command="{Binding ShutDownCommand}" />
                <MenuItem Header="View...">
                    <MenuItem Header="Zoom...">
                        <Slider MinWidth="100"
                                x:Name="uiZoomSlider" Value="{Binding ZoomViewModel.ZoomFactor, Mode=TwoWay}" Minimum="{Binding ZoomViewModel.MinZoomFactor}" Maximum="{Binding ZoomViewModel.MaxZoomFactor}" />
                    </MenuItem>
                    <MenuItem Header="Zoom to 100%" Command="{Binding ZoomViewModel.ZoomTo100PercentCommand}" />
                </MenuItem>
            </Menu>
        </StackPanel>
        
        <Border
            Background="SkyBlue"
            CornerRadius="3"
            Margin="5"
            Grid.Row="1" Grid.Column="0" Grid.RowSpan="2">
 
            <ContentControl 
                Regions:RegionManager.RegionName="{x:Static RegionNames:RegionNames.CommandsRegionName}"
                HorizontalAlignment="Stretch"
                VerticalAlignment="Stretch"
                HorizontalContentAlignment="Stretch"
                VerticalContentAlignment="Stretch"
                />

        </Border>

        <Border
            Background="SkyBlue"
            CornerRadius="3"
            Margin="5"
            Grid.Row="1" Grid.Column="1">

            <ContentControl 
                Regions:RegionManager.RegionName="{x:Static RegionNames:RegionNames.TextFileReaderRegionName}"
                HorizontalAlignment="Stretch"
                VerticalAlignment="Stretch"
                HorizontalContentAlignment="Stretch"
                VerticalContentAlignment="Stretch"
                />

        </Border>

        <Border
            Background="SkyBlue"
            CornerRadius="3"
            Margin="5"
            Grid.Row="2" Grid.Column="1"
            >

            <ContentControl 
                Regions:RegionManager.RegionName="{x:Static RegionNames:RegionNames.ChannelNamesParsingRegionName}"
                HorizontalAlignment="Stretch"
                VerticalAlignment="Stretch"
                HorizontalContentAlignment="Stretch"
                VerticalContentAlignment="Stretch"
                />

        </Border>
    </Grid>
    
</UserControl>
